var mapIds = [811000040, 811000050, 811000060, 811000070, 811000080];
var 准备地图 = 811000000;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("Boss_比睿山_浓姬分身");
    for (var b = 0; b < mapIds.length; b++) {
        var e = c.setInstanceMap(mapIds[b]);
        e.resetFully();
        e.killAllMonsters(false)
    }
    var e = c.getMapInstance(811000040);
    var d = em.getMonster(9450062);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(362, 187));
    var e = c.getMapInstance(811000050);
    var d = em.getMonster(9450071);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(-78, 187));
    var d = em.getMonster(9450070);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(351, 187));
    var d = em.getMonster(9450069);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(280, 187));
    var d = em.getMonster(9450068);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(193, 187));
    var d = em.getMonster(9450067);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(8, 187));
    var d = em.getMonster(9450063);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(106, 187));
    var e = c.getMapInstance(811000060);
    var d = em.getMonster(9450064);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(98, 187));
    var e = c.getMapInstance(811000070);
    var d = em.getMonster(9450065);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(158, 187));
    var e = c.getMapInstance(811000080);
    var d = em.getMonster(9450066);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(152, 187));
    return c
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(5);
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0));
    b.startEventTimer(15 * 60 * 1000);
    a.getAPI().mapleHeroBecomeNpc(2 - a.getParty().getPlayerOrder(a), 1)
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    em.setProperty("kill", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a);
    var d = em.getNumberProperty("state");
    em.setProperty("state", d + 1)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(a, b) {
    var c = a.getPlayerCount();
    if (player.getMap().getNumMonsters() == 0) {
        a.getPlayers().forEach(function (d) {
            d.getAPI().fieldEffect_ScreenMsg("monsterPark/clear");
            d.getAPI().fieldEffect_PlayFieldSound("Party1/Clear", 100)
        })
    }
    return 1
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}

function onMonsterDamaged() {}

function onItemPickedUp() {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
};